﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace BSU.CSCE.Web.Binders
{
    public abstract class BaseModelBinder : IModelBinder
    {
        #region IModelBinder Members

        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            return Bind(controllerContext, bindingContext);
        }

        public abstract object Bind(ControllerContext controllerContext, ModelBindingContext bindingContext);

        #endregion

        protected static Boolean ParseCheckBox(string checkBoxValue)
        {
            return checkBoxValue != null && checkBoxValue.StartsWith(Boolean.TrueString, StringComparison.OrdinalIgnoreCase);
        }
    }
}
